﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Foundation;
using RPGSoundmixer.SoundSuiteExplorer;
using RPGSoundmixer.SoundSuiteConfiguration;

namespace RPGSoundmixer {
    public partial class Form1 : Form {
        private KeyHandler handler;
        private CategorieCollection categories = CategorieCollection.GetInstance();
        
        private SoundSuiteConfigurationView soundSuiteConfigurationView; 


        public Form1() {
            InitializeComponent();
            this.soundSuiteConfigurationView = new SoundSuiteConfigurationView();
        
            handler = new KeyHandler(this);
            this.refreshCategorieList();
        }

        private void Form1_KeyPress(object sender, KeyPressEventArgs e) {
            handler.HandleKey(e.KeyChar);
        }

        internal void showCategories(List<string> list) {
            throw new NotImplementedException();
        }

        internal void showCategorieItems(object[] list) {
            this.listBox1.Items.Clear();
            this.listBox1.Items.AddRange(list);
        }

        private void listBox1_KeyPress(object sender, KeyPressEventArgs e) {
            Form1_KeyPress(sender, e);
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e) {

        }

        public AxWMPLib.AxWindowsMediaPlayer Player1 { get { return this.axWindowsMediaPlayer1; } }
        public AxWMPLib.AxWindowsMediaPlayer Player2 { get { return this.axWindowsMediaPlayer2; } }

        private void button1_Click(object sender, EventArgs e) {
            new Configuration(this.handler).ShowDialog();
            this.refreshCategorieList(); 
        }

        private void refreshCategorieList() {
            lstCategorie.Items.Clear();
            foreach (KeyValuePair<char, EffektGroup> pair in this.categories.Categories) {
                lstCategorie.Items.Add(pair.Value);
            }
        }

        private void button1_KeyPress(object sender, KeyPressEventArgs e) {
            Form1_KeyPress(sender, e); 
        }

        private void label1_Click(object sender, EventArgs e) {

        }

        private void Form1_Load(object sender, EventArgs e) {

        }

        public void setTitleName(string name) {
            this.label1.Text = name;
        }

        private void button2_Click(object sender, EventArgs e) {
            new TaggingForm().ShowDialog(); 
        }

        private void button3_Click(object sender, EventArgs e) {            
            this.soundSuiteConfigurationView.ShowDialog(); 
        }
        
        
    }
}
